package service.util;

import common.consts.YesNo;
import domain.PushMessage;

import java.util.Date;

/**
 * Created by aceyin on 15/6/30.
 */
public class MessagePushUtil {
    public static PushMessage createWorkApplyMessage(String applierName, long salerId) {
        PushMessage message = new PushMessage();
        message.setContent(applierName + "应聘了您的工作");
        message.setSenderName(applierName);
        message.setReceiver(salerId);
        message.setSubject(applierName + "应聘了您的工作");
        message.setCreateTime(new Date());
        message.setSent(YesNo.No.charVal);
        return message;
    }

    public static PushMessage createEmployMessage(String salerName, long userId) {
        PushMessage message = new PushMessage();
        message.setContent("恭喜，" + salerName + "接受了您的工作申请");
        message.setSenderName(salerName);
        message.setReceiver(userId);
        message.setSubject("恭喜，" + salerName + "接受了您的工作申请");
        message.setCreateTime(new Date());
        message.setSent(YesNo.No.charVal);
        return message;
    }

    public static PushMessage createRejectMessage(long applier, String salerName) {
        PushMessage message = new PushMessage();
        message.setContent("抱歉，" + salerName + "拒绝了您的工作申请");
        message.setSenderName(salerName);
        message.setReceiver(applier);
        message.setSubject("抱歉，" + salerName + "拒绝了您的工作申请");
        message.setCreateTime(new Date());
        message.setSent(YesNo.No.charVal);
        return message;
    }

    public static PushMessage createPayMessage(long applier, String salerName) {
        PushMessage message = new PushMessage();
        message.setSenderName(salerName);
        message.setSent(YesNo.No.charVal);
        message.setSubject("好消息," + salerName + "支付了工资给你");
        message.setContent("好消息," + salerName + "支付了工资给你");
        message.setCreateTime(new Date());
        message.setReceiver(applier);
        return message;
    }

    public static PushMessage createWithholdMessage(long user, String salerName, String reason) {
        PushMessage message = new PushMessage();
        message.setSenderName(salerName);
        message.setSent(YesNo.No.charVal);
        message.setSubject("抱歉," + salerName + "拒付了你的工资");
        message.setContent("抱歉," + salerName + "拒付了你的工资。原因:" + reason);
        message.setCreateTime(new Date());
        message.setReceiver(user);
        return message;
    }

    public static PushMessage createRewardMessage(long user, float amount) {
        PushMessage message = new PushMessage();
        message.setSenderName("点将");
        message.setSent(YesNo.No.charVal);
        message.setSubject("恭喜,您活的了奖励");
        message.setContent("恭喜，由于您工作出色，活的了额外嘉奖，奖金：" + amount + "元，请在您的钱包查收。");
        message.setCreateTime(new Date());
        message.setReceiver(user);
        return message;
    }

    public static PushMessage createFullMessage(String nick, Long applier) {
        PushMessage message = new PushMessage();
        message.setSenderName(nick);
        message.setSent(YesNo.No.charVal);
        message.setSubject("非常抱歉，招聘已经满了");
        message.setContent("非常抱歉，招聘名额已经满了，希望下次我们能有机会合作。");
        message.setCreateTime(new Date());
        message.setReceiver(applier);
        return message;
    }
}
